package com.fhz.kotlinstest

import android.util.Log
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Inject

private const val TAG = "UserRemoteDataSource"
class UserRemoteDataSource @Inject constructor() {

//    @Inject
//    lateinit var apiService: ApiService
    suspend fun getBanner(page: Int,size:Int): Banner {
        Log.i(TAG, "getBanner0: ")


        return Retrofit.Builder()
            .baseUrl("http://10.161.9.80:9999/banner/")
            .client(
                OkHttpClient.Builder()
                    .addInterceptor(
                        HttpLoggingInterceptor()
                            .setLevel(HttpLoggingInterceptor.Level.BODY))
                    .build())
            .addConverterFactory(GsonConverterFactory.create())
            .build().create(ApiService::class.java).getBanner(1,1)
    }

}